import { Component, OnInit } from "@angular/core";
import { StorageService } from "src/app/core/sotrage/storage.service";
import { Router, ActivatedRoute } from "@angular/router";
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { MessageService } from "src/app/core/service/message.service";
import { ApiService } from 'src/app/core/api';
import { NzMessageService } from 'ng-zorro-antd';

@Component({
    templateUrl: "./reportSubmit.html",
    styleUrls: ["./reportSubmit.scss"]
})
export class ReportSubmitComponent implements OnInit {
    validateForm: FormGroup;
    types=[{
        id:1,
        name:'委托检测'
    },{
        id:2,
        name:'型式检测'
    },{
        id:3,
        name:'远程检测'
    }]
    classes=['安全防范工程系统', '入侵报警类', '视频监控类', '道路交通类', '出入口控制类', '反恐防爆安检类', '生物识别类', '侦查防护类', '电磁兼容类', '电气安全类', '实体防护类',
    '警用装备类',
    '可靠性试验类',
    '信息安全类',
    '公安专用类',
    '软件类',
    '智能联网类',
    '信息系统'];
    inputValue;
    fileList = [];
    constructor(
        private apiService: ApiService,
        private route: ActivatedRoute,
        private router: Router,
        private nzMessageService: NzMessageService,
        private fb: FormBuilder
    ) {
        // this.initLoad();
    }
    typeShow;
    ngOnInit() {
        this.typeShow = this.route.snapshot.queryParams['type'];
        this.validateForm = this.fb.group({
            type: [null, [Validators.email, Validators.required]],
            porjuct: [null, [Validators.required]],
            user: [null, [Validators.required]],
            phoneNumber: [null, [Validators.required]],
            qyName: [null, [Validators.required]],
            porjuctName: [null, [Validators.required]],
            xh: [null]
          });
    }
    initLoad() {
    }
    _sel_1;
    _sel_2;

    submitForm(data) {
    }
    uploadFile = (item)=>{
        console.log(item);
        const file = item.file;
        const fileSize = file.size;
        const speed = 20000;
        this.fileList.push(file);
        
    }
    getFileSize = (size) => {
        let s = parseFloat((size/1024).toFixed(2));
        let a = "KB";
        if(s > 1024){
            a = "MB";
            s = parseFloat((s/1024).toFixed(2));
        }
        return s+a;
    }
}
